<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./vue.js"></script>
</head>
<body>
    <div id="app">
        <div>父组件</div>
        {{title}}
        <hr>
        <my-mo v-model="title"></my-mo>
    </div>
    <script>
        Vue.component("myMo",{
            props:{
                value:{
                    type:String
                }
            },
            template:`
                <div>
                    <div>这是一个测试</div>
                    <p>{{value}}</p>    
                    <button @click="change">更改</button>
                    <input type="text" v-model="de" @input="changeinput" />
                </div>
            `,
            data(){
                return {
                    de:this.value
                }
            },
            methods:{
                change(){
                    this.$emit("input","这是我更改的")
                },
                changeinput(){
                    // console.log(111);
                    this.value = this.de;
                    this.$emit("input",this.value)
                }
            }
        })
        let vm = new Vue({
            el:'#app',
            data:{
                title:'abc'
            }
        })
    </script>
</body>
</html>